import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lcapp/api/interface/user_api.dart';
import 'package:lcapp/api/request/response_data.dart';

class MinMoneyDetailPage extends StatefulWidget {
  const MinMoneyDetailPage({Key? key}) : super(key: key);

  @override
  _MinMoneyDetailPageState createState() => _MinMoneyDetailPageState();
}

class _MinMoneyDetailPageState extends State<MinMoneyDetailPage> {
  List golds = [];

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getGoldDetail();
  }

  getGoldDetail()async{
    ResponseData res = await UserAPI.getMinMoneyDetail();
    if(res.code==200){
      golds = res.data ??[];
    }
    if(mounted){setState(() {
    });}
  }

  @override
  Widget build(BuildContext context) {
    return EasyRefresh(
        child: ListView.builder(
            itemCount: golds.length,
            itemBuilder: (context,index){
              Map item = golds[index];
              return Container(
                color: Colors.transparent,
                height: 140.w,
                margin: EdgeInsets.only(bottom: 40.w),
                child: Column(
                  children: [
                    Expanded(child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Expanded(child: Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text('${item['detail']}',
                              style: TextStyle(
                                  color: Colors.black,
                                  fontSize: 32.sp,
                                  fontWeight: FontWeight.w600
                              ),),
                            SizedBox(height: 10.w,),
                            Text('${item['createTime']}',style: TextStyle(
                              color: Color(0xff848484),
                              fontSize: 24.sp,
                            ))
                          ],
                        )),
                        Container(
                          child: Text('${item['gold']}',style: TextStyle(
                            color: Color(0xff616161),
                            fontSize: 24.sp,
                          )),
                        ),
                      ],
                    )),
                    Container(
                      height: 1,
                      // margin: EdgeInsets.only(left: 120.w),
                      color: Color(0xffE9E8E9),
                    ),
                  ],
                ),
              );
            })
    );
  }
}
